// ProductApp class which uses ProductDB class and the Product object
import java.util.*;
public class ProductApp {
	private static Scanner sc;

	public static void main(String args [])
	{
		// displays a welcome message
		System.out.println("Welcome to the Product selector");
		System.out.println();
		
		sc = new Scanner(System.in);
		String choice = "y";
		while(choice.equalsIgnoreCase("y"))
		{
			// get the input from the user
			System.out.println("enter product code");
			String productCode=sc.next(); // read the product code
			sc.nextLine(); // discard any other data entered on the line
			
			//get the product object
			Product product= ProductDB.getProduct(productCode);
			
			// display the output
			System.out.println();
			System.out.println("SELECTED PRODUCT");
			System.out.println("DESCRIPTION: "+ product.getDescription());
			System.out.println("price:"+product.getFormattedPrice());
			System.out.println();
			//see if the user want to continue or not
			System.out.println("continue? (y/n):");
			choice=sc.nextLine();
			System.out.println();
		}
	}

}
 